package com.toKnow.controller;

import com.toKnow.model.vo.BasicVo;
import com.toKnow.model.vo.ExceptionVo;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class ExceptionController {
  @ExceptionHandler
  @ResponseBody
  public BasicVo commonExceptionHandler(Exception e) {
    ExceptionVo evo = new ExceptionVo(500, e.getMessage());
    return new BasicVo(false, e.getMessage(), evo);
  }
}
